package com.dura.search.util;

import com.dura.common.model.StandardReport;

import java.time.LocalDateTime;

/**
 * @version 1.0
 * @Author 振鹏
 * @Date 2025/3/19 21:50
 * @注释
 */
public class ThreadLocalUtils {
    /**
     * 索引前缀
     */
    public static final String INDEX = "sms_submit_log_";

    /**
     * 获取年份信息
     * @return
     */
    public static String getYear(){
        return LocalDateTime.now().getYear() + "";
    }

    public static String getCurrYearIndex(){
        return INDEX + getYear();
    }


    // ThreadLocal操作
    private static ThreadLocal<StandardReport> reportThreadLocal = new ThreadLocal<>();


    public static void set(StandardReport report){
        reportThreadLocal.set(report);
    }

    public static StandardReport get(){
        return reportThreadLocal.get();
    }

    public static void remove(){
        reportThreadLocal.remove();
    }
}
